let s = "aaaaaaa";
let wordDict = ["aaaa", "aaa"];

let dp = new Array(s.length + 1).fill(false)
dp[0] = true
for(let i = 1; i <= s.length; i++){
    for(j = 0; j < i; j++){
        if(dp[j] && wordDict.includes(s.substring(j, i))){
            dp[i] = true;
            break;
        }
    }
}
console.log(dp)
return dp[s.length];